package com.eastfair.producter.controller;

import com.eastfair.annotation.annotation.base.BaseControllerInfo;
import com.eastfair.core.base.R;
import com.eastfair.core.jackson.JsonUtil;
import com.eastfair.vo.VoGroupClass;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping()
public class ProductController {
    @Autowired
    private KafkaTemplate<String,Object> kafkaTemplate;


    /**
     * 测试发送kakfa
     * @param txt 内容
     * @return
     */
    @ApiOperation(value = "测试发送kakfa", notes = "测试发送kakfa")
    @GetMapping("/testproduct")
    public R testproduct(String txt) {
        try{
            kafkaTemplate.send("test", txt);
        }catch (Exception e){
            //说明kafaka没有，则不推送
        }


        return R.success();

    }
}
